﻿<script src="js/tm.pagination.js"></script>
<script src="scripts/staff.js"></script>
<script src ="scripts/httpService.js"></script>
<div class="pageheader">
    <h2><i class="fa fa-hand-o-up"></i> 人员管理 </h2>
</div>
<style>
        .page-list .pagination {float:left;}
        .page-list .pagination span {cursor: pointer;}
        .page-list .pagination .separate span{cursor: default; border-top:none;border-bottom:none;}
        .page-list .pagination .separate span:hover {background: none;}
        .page-list .page-total {float:left; margin: 25px 20px;}
        .page-list .page-total input, .page-list .page-total select{height: 26px; border: 1px solid #ddd;}
        .page-list .page-total input {width: 40px; padding-left:3px;}
        .page-list .page-total select {width: 50px;}
</style>
<div class="contentpanel" ng-app="staffApp" ng-controller="staffCtrl">
    <div class="row xg-content xg-staff">
        <div class="col-xs-12">
            <div class="btn-group fl">
                <button type="button" class="btn btn-warning" ng-click="refreshStaff()">
                    <span class="glyphicon glyphicon-refresh"></span> 刷新
                </button>
                <button type="button" class="btn btn-success" ng-click="updateStaff()">
                    <span class="glyphicon glyphicon-send"></span> 更改员工信息
                </button>
                <button type="button" class="btn btn-primary" ng-click="addStaff()">
                    <span class="glyphicon glyphicon-pencil"></span> 添加员工
                </button>
                <button type="button" class="btn btn-danger" ng-click="deleteStaff()">
                    <span class="glyphicon glyphicon-trash"></span> 删除
                </button>
            </div>
            <div class="xg-search fr">
                <div class="input-group">
                    <div class="input-group-addon">关键词</div>
                    <input class="form-control" type="text" ng-model="nameKeywords" placeholder="姓名,工号或手机号">
                </div>
                <div class="xg-search-btn">
                    <a href="#" class="btn btn-info-alt" ng-click="searchByName()">搜索</a>
                </div>
                <div class="input-group pull-right">
                    <div class="input-group-addon">科室</div>
                    <select class="form-control"  ng-options="department.id as department.name for department in departments" ng-model="staff.departmentid" ng-change="departmentChange(staff.departmentid)">
              
                    </select>
                </div>
            </div>
            <table class="table table-striped table-hover">
                <tr>
                    <th>选择</th>                    
                    <th>姓名</th>
                    <th>工号</th>
                    <th>手机号</th>
                    <th>科室</th>
                    <th>性别</th>
                    <th>级别</th>
                    <th>人员类别</th>
                    <th>是否冻结</th>
                    <th>最后登录时间</th>
                    <th>自定票数</th>
                    <th>亲属票数</th>
                    <th>退票次数</th>
                    <!-- <th>最后登录IP</th> -->
                    <th>备注</th>
                   <!-- <th>查看明细</th> -->
                </tr>
                <tr ng-repeat="staff in staffs" ng-click="selectChange($index)">
                    <td>
                        <input type="checkbox" ng-model="staff.checked" />
                    </td>
                    
                    <td ng-bind="staff.name"></td>
                    <td ng-bind="staff.number"></td>
                    <td ng-bind="staff.phone"></td>
                    <td ng-bind="staff.departmentname"></td>
                    <td ng-if="staff.sex==0">女</td>
                    <td ng-if="staff.sex==1">男</td>
                    <td ng-if="staff.level==1">科员</td>
                    <td ng-if="staff.level==2">科级</td>
                    <td ng-if="staff.level==3">处级</td>
                    <td ng-if="staff.status==0">正式职工</td>
                    <td ng-if="staff.status==1">招聘</td>
                    <td ng-if="staff.status==2">劳务派遣</td>
                    <td ng-if="staff.status==3">退休返聘</td>
                    <td ng-if="staff.status==4">离退休</td>
                    
                    <td ng-if="staff.iseabled==true">正常</td>
                    <td ng-if="staff.iseabled==false">冻结</td>
                    <td ng-bind="staff.lastlogindate"></td>
                    <td ng-bind="staff.owncount"></td>
                    <td ng-bind="staff.relativecount"></td>
                    <td ng-bind="staff.refundcount"></td>
                    <!-- <td ng-bind="staff.lastloginip"></td> -->
                    <td ng-bind="staff.other"></td>
                    <!-- <td><a ng-click="orderDetail(staff.id)">查看明细</a></td> -->
                </tr>

            </table>
            
           <tm-pagination conf="paginationConf"></tm-pagination>
        </div>
    </div>

    <script type="text/ng-template" id="modifyStaff">
        <div class='modal-content'  >

            <div class='modal-header'>
                <button type='button' class='close' data-dismiss='modal' ng-click="close()" >&times;</button>
                <h2 class='modal-title' style="padding-left:40%" id='addParkLabel'>职工信息</h2>
            </div>

            <div class='modal-body '>
                <form class='form-horizontal' role='form'>
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                基本信息
                            </h3>
                        </div>
                        <div class="panel-body">
                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">姓名</label>
                                </div>
                                <div class='col-sm-4'>
                                    <input type='text' class='form-control' ng-model="mstaff.name" placeholder='请输入姓名'/>
                                </div>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right" >员工号</label>
                                </div>
                                <div class='col-sm-4'>
                                    <input type='text' class='form-control' ng-model="mstaff.number" placeholder='请输入员工号'/>
                                </div>
                            </div>

                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">密码</label>
                                </div>
                                <div class='col-sm-4'>
                                    <input type='password' class='form-control hidden' ng-model="mstaff.password" placeholder='请输入密码' />
                                    <button class="btn btn-info" ng-click="initPassword()" ng-if="isInitPassword">重置密码为默认</button>
                                </div>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right" >科室</label>
                                </div>
                                <div class='col-sm-4'>
                                    <select class="form-control" ng-options="d.id as d.name for d in departments" ng-model="mstaff.departmentid"></select>
                                </div>
                            </div>

                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">性别</label>
                                </div>
                                <div class='col-sm-4'>
                                    <select class="form-control" ng-options="s.id as s.sex for s in sexes" ng-model="mstaff.sex"></select>
                                </div>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right" >级别</label>
                                </div>
                                <div class='col-sm-4'>
                                    <select class="form-control" ng-options="l.id as l.name for l in levels" ng-model="mstaff.level"></select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="panel panel-danger">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                附加信息
                            </h3>
                        </div>
                        <div class="panel-body">

                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">状态</label>
                                </div>
                                <div class='col-sm-4'>
                                    <select class="form-control" ng-options="s.id as s.status for s in statuses" ng-model="mstaff.status"></select>
                                </div>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right" >是否冻结</label>
                                </div>
                                <div class='col-sm-4'>
                                    <select class="form-control" ng-options="st.id as st.Eabled for st in staffIsEabled" ng-model="mstaff.iseabled"></select>
                                </div>
                            </div>

                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">最后登录时间</label>
                                </div>
                                <div class='col-sm-4'>
                                    <input type='text' class='form-control' ng-model="mstaff.lastlogindate" placeholder='最后登录时间'/>
                                </div>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right" >最后登录IP</label>
                                </div>
                                <div class='col-sm-4'>
                                    <input type='text' class='form-control' ng-model="mstaff.lastloginip" placeholder='最后登录IP'/>
                                </div>
                            </div>

                            <div class='form-group '>
                                <div class="col-sm-2 ">
                                    <label class='control-label' style="float:right">备注</label>
                                </div>
                                <div class="col-sm-10 ">
                                    <input type='text' class='form-control' ng-model="mstaff.other" placeholder='填写备注信息'/>
                                </div>
                            </div>
                </form>
            </div>
        </div>

        <div class="alert alert-info" ng-show="loading || submitted">
            <span  ng-show='loading' > <i class="fa fa-spinner"></i></span>
            <span ng-show='submitted'>{{result}}</span>
        </div>

        </div>
        <div class='modal-footer'>
            <button type='button' class='btn btn-default' id="modalCloseBtn" data-dismiss='modal' ng-click="close()">关闭</button>
            <button id="submitParkBtn" type='button' ng-click="submit()" class='btn btn-primary'>提交</button>
        </div>

        </div>

    </script>
</div><!-- contentpanel -->

</div><!-- mainpanel -->
<script src="js/xg_js.js"></script>
<script>
    createMenu(10);
</script>
